
<template>
	<div class="yongjindakuan">
    <div v-if="!shoujiban">
      <left></left>
      <div class="right">
        <div style="height: 91px; border-bottom: 1px solid rgb(227, 232, 241); width: 100%; padding: 0 30px;" class="flexbc">
          <el-breadcrumb separator-class="el-icon-arrow-right">
            <el-breadcrumb-item :to="{ path: '/yongjin' }">财务管理</el-breadcrumb-item>
            <el-breadcrumb-item>佣金打款</el-breadcrumb-item>
          </el-breadcrumb>
          <top></top>
        </div>
        <div style=" padding: 37px 30px 0 30px; height: calc(100vh - 91px); overflow: auto;">

          <div class="flexc" style="padding: 0px 0 20px;">
            <div><el-button style="margin: 0px 10px;" type="primary" v-if="search.status != 10" round @click="changestatus('')">全部</el-button></div>
          <div><el-button style="margin: 0px 10px;" v-if="search.status == 10" round @click="changestatus('')">全部</el-button></div>
          <div><el-button style="margin: 0px 10px;" v-if="search.status != 10" round  @click="changestatus(10)">已打款</el-button></div>
          <div><el-button style="margin: 0px 10px;" type="primary" v-if="search.status == 10" round  @click="changestatus(10)">已打款</el-button></div>
          </div>

          <div style="height: 112px; background: rgb(255, 255, 255); border-radius: 20px; padding: 20px;" class="flexb">
              <div class="flex">
                <div>
                  <div style="margin-bottom: 10px;">提现人</div>
                  <div><el-input v-model="search.merchant_name" style="width: 200px; margin-right: 30px;" placeholder="请输入"></el-input></div>
                </div>
                <div>
                  <div style="margin-bottom: 10px;">打款状态</div>
                  <div>
                    <el-select clearable filterable style="width: 200px; margin-right: 30px;" v-model="search.status" placeholder="请选择">
                      <el-option  label="已打款"  value="10"></el-option>
                      <el-option  label="待打款"  value="0"></el-option>
                      <el-option  label="打款失败"  value="1"></el-option>
                      <el-option  label="打款中"  value="2"></el-option>
                    </el-select>
                  </div>
                </div>
                <div>
                  <div style="margin-bottom: 10px;">打款时间</div>
                  <div class="flexc">
                    <el-date-picker v-model="times" @change="changetimes"  value-format="yyyy-MM-dd HH:mm:ss" style="margin-right: 30px;" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
                  </div>
                </div>
                <div style="margin-right: 30px;">
                  <div style="margin-bottom: 10px;">&nbsp;</div>
                  <div><el-button type="primary" round icon="el-icon-search" @click="sousuo">检索</el-button></div>
                </div>
              </div>
              <div>
              <div style="margin-bottom: 10px;">&nbsp;</div>
              <div style="display: flex;align-items: center;">
                <div v-if="nowmoneyobj.total_balance!=''" style="margin-right: 40px;">云账户余额：<span style="color: #ec5201;">{{ nowmoneyobj.total_balance }}</span></div>
                <el-button type="primary" round icon="el-icon-search" @click="peizhikai">发票配置</el-button>
              </div>
            </div>
            </div>
            <el-table :data="list" style="width: 100%">
          <el-table-column align="center" prop="id" label="提现ID"></el-table-column>
          <el-table-column align="center" prop="shop_name" label="申请提现人"></el-table-column>
          <el-table-column align="center" width="200px" prop="withdraw_at" label="提现申请时间"></el-table-column>
          <el-table-column align="center" prop="orders_count" label="提现订单数量"></el-table-column>
          <el-table-column align="center" prop="sum_commission" label="提现金额"></el-table-column>
          <el-table-column align="center" prop="invoice_way" label="票据类型">
            <template slot-scope="scope">
              <div @click="log6show(scope.row)" style="color: rgb(0, 90, 255)">{{scope.row.invoice_info}}</div>
            </template>
          </el-table-column>
          <el-table-column align="center" prop="tax_amount" label="扣除税点金额"></el-table-column>
          <el-table-column align="center" prop="withdraw_amount" label="实际支出金额"></el-table-column>
          <el-table-column align="center" label="打款状态">
            <template slot-scope="scope">
              <div v-if="scope.row.status == 10" style="color: rgb(9, 134, 0);">已打款</div>
              <div v-if="scope.row.status == 0" style="color: rgb(236, 82, 1);">待打款</div>
              <div v-if="scope.row.status == 1" style="color: rgb(236, 82, 1);">
                <el-tooltip class="item" effect="dark" :content="scope.row.failed_reason" placement="top">
                  <div>
                    打款失败
                    <i style="color:  rgb(236, 82, 1);" class="el-icon-warning"></i>
                  </div>
                </el-tooltip>
              </div>
              <div v-if="scope.row.status == 2" style="color: rgb(236, 82, 1);">打款中</div>
            </template>
          </el-table-column>
          <el-table-column align="center" width="200px" prop="pay_way" label="打款方式">
            <template slot-scope="scope">
              <div v-if="scope.row.pay_way == 0&&scope.row.status != 0" >未知</div>
              <div v-if="scope.row.pay_way == 0&&scope.row.status == 0" >-</div>
              <div v-if="scope.row.pay_way == 1" >线下</div>
              <div v-if="scope.row.pay_way == 2" >云账户</div>
            </template>
          </el-table-column>
          <el-table-column align="center" width="200px" prop="withdraw_at" label="打款时间"></el-table-column>
          <el-table-column align="center" label="操作" width="250px">
            <template slot-scope="scope">
              <div class="flexcc">
                <div v-if="scope.row.status == 10" style="color: rgb(0, 90, 255); cursor: pointer; margin-right: 20px;" @click="luru(scope.row,1)">查看详情</div>
                <div v-if="scope.row.status == 0||scope.row.status == 2" style="color: rgb(0, 90, 255); cursor: pointer; margin-right: 20px;" @click="luru(scope.row,2)">录入打款信息</div>
                <div v-if="nowmoneyobj.total_balance!=''&&(scope.row.status == 0||scope.row.status == 1)" style="color: rgb(0, 90, 255); cursor: pointer;" @click="payyzh(scope.row)">云账户打款</div>
                <div v-if="scope.row.status == 2"  >打款中</div>
              </div>
            </template>
          </el-table-column>
        </el-table>

        <el-pagination style="text-align: right; padding: 20px;" background layout="prev,pager,next,total,jumper" :current-page="search.page"
         @current-change="fanye" :page-size="search.page_size" :total="total"></el-pagination>
		 <!-- <footers></footers> -->
        </div>



      </div>
    </div>


    <el-dialog title="发票配置" :visible.sync="log" width="640px" :close-on-click-modal="false" :close-on-press-escape="false">
      <div style="font-size: 18px; margin-bottom: 20px;">发票类型</div>
      <div style="margin-bottom: 30px;">
        <div class="flexc" v-for="item in fapiaoall.configs" :key="item.type" style="margin-bottom: 10px;">
          <div style="margin-right: 20px;"><el-checkbox v-model="item.ok" :true-label="1" :false-label="0"></el-checkbox></div>
          <div style="margin-right: 40px;">{{item.name}}</div>
          <div v-if="item.type != 4 && item.type != 5">税点{{item.tax}}</div>
          <div v-if="item.type == 4">
            <el-select clearable filterable style="width: 200px; margin-right: 30px;" v-model="item.tax" placeholder="请选择">
              <el-option  :label="0.01"  :value="0.01"></el-option>
              <el-option  :label="0.02"  :value="0.02"></el-option>
              <el-option  :label="0.03"  :value="0.03"></el-option>
              <el-option  :label="0.04"  :value="0.04"></el-option>
              <el-option  :label="0.05"  :value="0.05"></el-option>
              <el-option  :label="0.06"  :value="0.06"></el-option>
            </el-select>
          </div>
        </div>
      </div>
      <div style="font-size: 18px; margin-bottom: 20px;">开票信息</div>
      <div style="font-size: 12px; margin-bottom: 30px;">
        <el-input type="textarea" :rows="5" placeholder="请输入内容" v-model="fapiaoall.info"></el-input>
      </div>
      <div style="font-size: 18px; margin-bottom: 20px;">邮寄地址</div>
      <div class="flexc" style="margin-bottom: 20px;">
        <div style="width: 100px; text-align: right; color: rgb(42, 42, 42); font-size: 14px; margin-right: 15px;">输入收件人</div>
        <div><el-input v-model="fapiaoall.addr_name" style="width: 200px; margin-right: 30px;" placeholder="请输入收件人"></el-input></div>
      </div>
      <div class="flexc" style="margin-bottom: 20px;">
        <div style="width: 100px; text-align: right; color: rgb(42, 42, 42); font-size: 14px; margin-right: 15px;">联系电话</div>
        <div><el-input v-model="fapiaoall.addr_mobile" style="width: 200px; margin-right: 30px;" placeholder="请输入联系电话"></el-input></div>
      </div>
      <div class="flexc" style="margin-bottom: 20px;">
        <div style="width: 100px; text-align: right; color: rgb(42, 42, 42); font-size: 14px; margin-right: 15px;">收件地址</div>
        <div class="flex">
          <el-input v-model="fapiaoall.addr_province" style="width: 120px; margin-right: 30px;" placeholder="请输入"></el-input>
          <el-input v-model="fapiaoall.addr_city" style="width: 120px; margin-right: 30px;" placeholder="请输入"></el-input>
          <el-input v-model="fapiaoall.addr_district" style="width: 120px; margin-right: 30px;" placeholder="请输入"></el-input>
        </div>
      </div>
      <div class="flexc" style="margin-bottom: 20px;">
        <div style="width: 100px; text-align: right; color: rgb(42, 42, 42); font-size: 14px; margin-right: 15px;">&nbsp;</div>
        <div class="flex">
          <el-input v-model="fapiaoall.addr" style="width: 420px; margin-right: 30px;" placeholder="请输入"></el-input>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button round @click="log = false">关闭</el-button>
        <el-button round type="primary" @click="peizhi">确定</el-button>
      </span>
    </el-dialog>

    <el-dialog :title="tixianren" :visible.sync="log2" width="800px" :close-on-click-modal="false" :close-on-press-escape="false">
      <div style="font-size: 18px; margin-bottom: 20px; font-weight: bold;">提现金额</div>
      <div style="background: rgb(255, 245, 245);border-radius: 10px; padding: 20px; justify-content: space-around; margin-bottom: 20px;" class="flexc" >
        <div style="text-align: center;">
          <div style="color:rgb(64, 66, 71); font-size: 16px; margin-bottom: 10px;">提现金额</div>
          <div style="color:rgb(254, 61, 61); font-size: 16px; font-weight: bold;">￥{{all2.sum_commission}}</div>
        </div>
        <div style="text-align: center;">
          <div style="color:rgb(64, 66, 71); font-size: 16px; margin-bottom: 10px;">增值税税额</div>
          <div style="color:rgb(254, 61, 61); font-size: 16px; font-weight: bold;">￥{{all2.tax_amount}}</div>
        </div>
        <div style="text-align: center;">
          <div style="color:rgb(64, 66, 71); font-size: 16px; margin-bottom: 10px;">实际到账金额</div>
          <div style="color:rgb(254, 61, 61); font-size: 16px; font-weight: bold;">￥{{all2.withdraw_amount}}</div>
        </div>
      </div>
      <div style="font-size: 18px; margin-bottom: 20px; font-size: 14px;">开票类型：{{all2.invoice_info}}</div>
      
      <div style="font-size: 18px; margin-bottom: 20px; font-weight: bold;" v-if="all2.collect_type == 1">收款账户</div>
      <div style="margin-bottom: 20px;" v-if="all2.collect_type == 1">
        
        <div class="flex" style="margin-bottom: 20px;">
          
          <div style="width: 220px;">卡号：{{all2.bank_no}}</div>
          <div style="width: 220px;">开户人：{{all2.bank_name}}</div>
          <div style="width: 220px;">身份证号：{{all2.bank_idcard}}</div>
        </div>
        <div class="flex">
          <div style="width: 220px;">开户行：{{all2.bank}}</div>
          <div style="width: 220px;">开户支行行：{{all2.bank_sub}}</div>
        </div>
      </div>
      <div v-if="lurutype==1" style="font-size: 18px; margin-bottom: 20px; font-weight: bold;" >打款信息</div>
      <div v-if="lurutype==1" style="margin-bottom: 20px;" >
        <div  style="margin-bottom: 20px;">
          <div style="width: 220px;margin-bottom: 20px;font-weight: bold;">
            <span>{{ all2.withdraw_at }}</span>，
            <span v-if="all2.status==10">已打款</span>
            <span v-if="all2.status==0">待打款</span>
            <span v-if="all2.status==1">打款失败</span>
            <span v-if="all2.status==2">打款中</span>
            
          </div>
          <div style="width: 220px;">
            打款方式：
            <span v-if="all2.pay_way==0&&all2.status != 0">未知</span>
            <span v-if="all2.pay_way==0&&all2.status == 0">-</span>
            <span v-if="all2.pay_way==1">线下</span>
            <span v-if="all2.pay_way==2">云账户</span>
          </div>
          <div v-if="all2.pay_way==2" style="width: 220px;margin-bottom: 20px;margin-top: 20px;">打款订单ID：{{all2.payment_txn}}</div>
        </div>
      </div>
      <div style="font-size: 18px; margin-bottom: 20px; font-weight: bold;" v-if="all2.collect_type == 1">上传打款截图</div>
      <div v-if="!all2.withdraw_pic && all2.collect_type == 1" class="flexcc" style="width: 100%; height: 220px; background: rgb(246, 248, 251);" >
        Ctrl+V直接粘贴截图
      </div>
      <div v-if="all2.withdraw_pic && all2.collect_type == 1" class="flexcc" style="width: 100%; background: rgb(246, 248, 251);">
        <img :src="all2.withdraw_pic" style="max-width: 100%;">
      </div>

      <div style="margin-bottom: 20px;" v-if="all2.collect_type == 2">
        <div class="flex" style="margin-bottom: 20px;">
          <div style="width: 220px;">支付宝号：{{all2.ali_no}}</div>
          <div style="width: 220px;">姓名：{{all2.ali_name}}</div>
          <div style="width: 220px;">身份证号：{{all2.ali_idcard}}</div>
        </div>
      </div>
      <div style="font-size: 18px; margin-bottom: 20px; font-weight: bold;" v-if="all2.collect_type == 2">转账备注</div>
      <el-input v-model="all2.withdraw_remark" style="width: 320px; margin-right: 30px;" placeholder="请输入" v-if="all2.collect_type == 2"></el-input>
      <span slot="footer" class="dialog-footer">
        <el-button round @click="log2 = false">关闭</el-button>
        <el-button round type="primary" @click="quedingdakuan">打款完成</el-button>
      </span>
    </el-dialog>

    <el-dialog title="查看发票" :visible.sync="log6" width="820px" :close-on-click-modal="false" :close-on-press-escape="false">
      <div v-if="log6fapiao.invoice_way == 2" style="margin-bottom: 20px;">
        物流公司：{{log6fapiao.track_company}}
      </div>
      <div v-if="log6fapiao.invoice_way == 2">
        单号：{{log6fapiao.track_no}}
      </div>
      <div v-if="log6fapiao.invoice_way == 1">
        <a :href="log6fapiao.invoice_img" target="_blank" style="color: rgb(0, 90, 255);">{{log6fapiao.invoice_img}}</a>
      </div>
      <div v-if="log6fapiao.invoice_way == 1" class="flexcc" style="margin: 20px 0;"><el-button round plain type="primary" @click="down(log6fapiao.invoice_img)">下载</el-button></div>

      <span slot="footer" class="dialog-footer">
        <el-button round @click="log6 = false">关闭</el-button>
      </span>
    </el-dialog>
    <!-- 云账户打款弹窗 -->
    <el-dialog
      title="云账户打款"
      :visible.sync="isshowyzhpay"
      :close-on-click-modal="false"
      width="400px">
      <div style="text-align: center;font-size: 16px;">
        <div style="margin-bottom:30px">您将使用云账户支付：￥{{ iscanpayinfo.withdraw_amount }}</div>
        <div style="font-weight: bold;">
          云账户余额：{{ iscanpayinfo.total_balance }}元
          <span v-if="iscanpayinfo.total_balance*1>=iscanpayinfo.withdraw_amount*1" style="margin-left: 10px;color: #67C23A;">充足</span>
          <span v-else style="margin-left: 10px;color: #F56C6C;">不足</span>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button round @click="isshowyzhpay = false">取 消</el-button>
        <el-button :disabled="iscanpayinfo.total_balance*1<iscanpayinfo.withdraw_amount*1" round type="primary" @click="surepay">确 定</el-button>
      </span>
    </el-dialog>

    <!-- 手机版 -->
      <div v-if="shoujiban" style=" color: rgb(2, 12, 29); font-size: 0.24rem; background: #f6f8fb; padding-top: 1rem;">
        <topandleft></topandleft>
        <div style="background: #fff; padding: 0.3rem;">
          <div class="flexc" style="margin-bottom: 0.3rem;">
            <div style="width: 2px; height: 0.2rem; background: rgb(2, 12, 29); margin-right: 10px; overflow: hidden;"></div>
            <div style="font-size: 0.36rem; font-weight: bold;">财务管理</div>
          </div>
          <div class="flexc" style="margin-bottom: 0.3rem;">
            <div style="color: rgb(175, 179, 188);">首页</div>
            <div style="margin: 0 0.2rem;color: rgb(175, 179, 188);">·</div>
            <div style="color: rgb(175, 179, 188);">财务管理</div>
            <div style="margin: 0 0.2rem;color: rgb(175, 179, 188);">·</div>
            <div>佣金打款</div>
          </div>
        </div>
        <div style="background: #fff; border-radius: 0.45rem; padding: 0.1rem; margin: 0.3rem 0.3rem; margin-top: 0.2rem;">
          <div class="flex">
            <div @click="changestatus(0)" style="flex: 1; background: rgb(255, 255, 255); color: rgb(64, 66, 71); text-align: center; line-height: 0.7rem; border-radius: 0.35rem;" :class="{act:search.status == 0}">待打款</div>
            <div @click="changestatus(10)" style="flex: 1; background: rgb(255, 255, 255); color: rgb(64, 66, 71); text-align: center; line-height: 0.7rem; border-radius: 0.35rem;" :class="{act:search.status == 10}">已打款</div>
          </div>
        </div>
        <div style="padding: 0.3rem; ">
          <div style="background: #fff; padding: 0.2rem; border-radius: 0.2rem;">
            <div><el-input v-model="search.merchant_name" style="width: 100%;margin-bottom: 0.2rem;" placeholder="请输入提现人"></el-input></div>
            <div>
              <el-select clearable filterable style="width: 100%;margin-bottom: 0.2rem;" v-model="search.status" placeholder="请选择打款状态">
                <el-option  label="已打款"  value="10"></el-option>
                <el-option  label="待打款"  value="0"></el-option>
              </el-select>
            </div>
          <div class="flexbc" style="margin-bottom: 0.2rem;">
            <div class="datashow" @click="xuanshijianshow(1)" style="color: #C0C4CC;" v-if="!search.start">请选择开始日期</div>
            <div class="datashow" @click="xuanshijianshow(1)" v-if="search.start">{{search.start}}</div>
            <div >~</div>
            <div class="datashow" @click="xuanshijianshow(2)" style="color: #C0C4CC;" v-if="!search.end">请选择结束日期</div>
            <div class="datashow" @click="xuanshijianshow(2)" v-if="search.end">{{search.end}}</div>
          </div>
          <van-popup v-model="showdate" round position="bottom">
            <van-datetime-picker type="date" :min-date="minDate" title="选择时间"  @confirm="xuanshijian" @cancel="showdate = false"  />
          </van-popup>
            <!-- <div class="flex" >
              <el-date-picker
                style="width: 46%;margin-bottom: 0.2rem;"
                v-model="search.start"
                value-format="yyyy-MM-dd HH:mm:ss"
                type="datetime"
                placeholder="选择开始日期">
              </el-date-picker>
              <span style="margin-left: 10px;margin-right: 10px;color: #AFB3BC;">-</span>
              <el-date-picker
                style="width: 46%;margin-bottom: 0.2rem;"
                v-model="search.end"
                value-format="yyyy-MM-dd HH:mm:ss"
                type="datetime"
                placeholder="选择结束日期">
              </el-date-picker>
            </div> -->
            <div>
              <el-button type="primary" round icon="el-icon-search" @click="sousuo">检索</el-button>
              <el-button type="primary" round icon="el-icon-search" @click="peizhikai">发票配置</el-button>
            </div>
          </div>
        </div>
        <div style="margin:0 0.3rem; ">
          <van-list  v-model="loading"  :finished="finished"  finished-text="没有更多了"  @load="onLoad">
              <div v-for="item in list" :key="item.id" style="background: #fff; padding: 0.2rem; margin-bottom: 0.2rem; border-radius: 0.2rem;">
                <div class="flexbc" style="margin-bottom: 0.2rem;">
                  <div>提现ID</div>
                  <div>{{item.id}}</div>
                </div>
                <div class="flexbc" style="margin-bottom: 0.2rem;">
                  <div>申请提现人</div>
                  <div>{{item.shop_name}}</div>
                </div>
                <div class="flexbc" style="margin-bottom: 0.2rem;">
                  <div>提现申请时间</div>
                  <div>{{item.withdraw_at}}</div>
                </div>
                <div class="flexbc" style="margin-bottom: 0.2rem;">
                  <div>提现订单数量</div>
                  <div>{{item.orders_count}}</div>
                </div>
                <div class="flexbc" style="margin-bottom: 0.2rem;">
                  <div>提现金额</div>
                  <div>{{item.sum_commission}}</div>
                </div>
                <div class="flexbc" style="margin-bottom: 0.2rem;">
                  <div>票据类型</div>
                  <div>{{item.invoice_way}}</div>
                </div>
                <div class="flexbc" style="margin-bottom: 0.2rem;">
                  <div>扣除税点金额</div>
                  <div>{{item.tax_amount}}</div>
                </div>
                <div class="flexbc" style="margin-bottom: 0.2rem;">
                  <div>实际支出金额</div>
                  <div>{{item.withdraw_amount}}</div>
                </div>
                <div class="flexbc" style="margin-bottom: 0.2rem;">
                  <div>打款状态</div>
                  <div>
                    <div v-if="item.status == 10" style="color: rgb(9, 134, 0);">已打款</div>
                    <div v-if="item.status == 0" style="color: rgb(236, 82, 1);">待打款</div>
                  </div>
                </div>
                <div class="flexbc" style="margin-bottom: 0.2rem;">
                  <div>打款时间</div>
                  <div>{{item.withdraw_at}}</div>
                </div>
                <div class="flexc">
                  <div style="color: rgb(0, 90, 255); cursor: pointer; margin-right: 20px;" @click="luru(item,2)">录入打款信息</div>
                  <div style="color: rgb(0, 90, 255); cursor: pointer;">云账户打款</div>
                </div>

              </div>
          </van-list>
        </div>
      </div>
	</div>
</template>

<script>
  import left from '../left.vue'
  import top from '../top.vue'
  import footers from '../footer.vue'
  import * as qiniu from 'qiniu-js'
  import topandleft from '../topandleft.vue'
	export default {
		name: 'yongjindakuan',
    components:{
      left,top,topandleft,footers
    },
		data() {
			return {
        log:false,
        log2:false,
        search:{
          page:1,
          page_size:20,
          merchant_name:"",
          status:'',
          start:"",
          end:""
        },
        list:[],
        total:0,
        all:{
          checkedCities:[]
        },
        widthss:false,
        fapiaoall:{
          configs:""
        },
        fapiaojson:[],
        all2:"",
        times:[],
        log6:false,
        log6fapiao:"",
        tixianren:"提现人",
        isshowyzhpay:false,
        rowinfo:'',
        nowmoneyobj:{},
        iscanpayinfo:{},
        shoujiban:false,
        loading: false,
        finished: false,
        lurutype:'',
        showdate:false,
        whodata:"",
        minDate: new Date(2023, 0, 1)
			}
		},
		created() {
      // this.getlist()
      this.getfapiao()
      //账户余额
      this.nowmoney()
		},
		mounted() {
      if(window.screen.width == 1920){
        this.widthss = true
      }

      document.addEventListener('paste', this.getClipboardFiles)

      if(window.screen.width < 1080){
        this.shoujiban = true
        var h = document.documentElement.clientWidth / 7.5 + 'px';
        document.documentElement.style.fontSize = h;

        // this.onLoad()
      }else{
        this.getlist()
      }
		},
		methods: {
      xuanshijianshow:function(val){
        if(val == 1){
          this.showdate = true
          this.whodata = 'start'
        }
        if(val == 2){
          this.showdate = true
          this.whodata = 'end'
        }
      },
      xuanshijian:function(val){
        this.search[this.whodata] = moment(val).format('YYYY-MM-DD hh:mm:ss')
        this.showdate = false
      },
      onLoad() {
        axios.get('/own/commission/withdrawtakes',{params:this.search}).then((response)=>{
        	if (response.data.msg.code == 0) {
            if(response.data.data.data.length > 0){
              response.data.data.data.forEach(item=>{
                this.list.push(item)
              })
              if (this.list.length >= response.data.data.total) {
                this.finished = true;
              }else{
                this.search.page++
                this.loading = false;
              }
            }else{
              this.finished = true;
            }

        	} else {
        		this.$message.error(response.data.msg.info);
        	}
        })
      },
      down:function(item){
        window.location.href = item
      },
      log6show:function(item){
        this.log6fapiao = item
        this.log6 = true
      },
      changestatus:function(val){
        if(val){
          this.search.status = val.toString()
        }else{
          this.search.status = ''
        }

        this.getlist()
      },
      changetimes:function(){
        if(this.times != null){
          this.search.start = this.times[0]
          this.search.end = this.times[1]
        }else{
          this.search.start = ''
          this.search.end = ''
        }
      },
      //传图相关====================
      getClipboardFiles (event) {
         let items = event.clipboardData && event.clipboardData.items;
         let file = null
        if(this.log2 == true ){
            if (items && items.length) {
              // 检索剪切板items
              for (var i = 0; i < items.length; i++) {
                if (items[i].type.indexOf('image') !== -1) {
                  file = items[i].getAsFile()
                }
              }
            }
            if (!file) {
              this.$message.error('粘贴内容不是图片')
              return;
            }
            this.uploadok(file)
           // this.wenjian = file
           // var that = this
           // var reader = new FileReader(), htmlImage;
           // reader.onload = function(e) {
           //   console.log(e)
           //     // that.imageurl = e.target.result
           //     // that.tixianxinxi.image = e.target.result
           // }
           // reader.readAsDataURL(file);
         }
      },
      getRandomChar:function(len = 11)  {
        var  x = "0123456789qwertyuioplkjhgfdsazxcvbnm" // 需要什么字符这里添加
        var  tmp = ""
        var timestamp = new Date().getTime();
        for(var  i=0;i<len;i++)  {
          tmp += x.charAt(Math.ceil(Math.random()*100000000)%x.length);
        }
        return  timestamp+tmp;
      },
      uploadok: function(file) {
        let name = this.getRandomChar() + '.' + file.name.split('.')[1]
        var that = this
        axios.post(`/api/qiniu/uploadtoken`,{name:name})
          .then(response => {
            if(response.data.msg.code == 0){
              const observer = {
                next(res){
                  console.log(res)
                },
                error(err){
                  console.log(err)
                },
                complete(res){
                  that.all2.withdraw_pic = 'https://gperson.gantanhaokeji.top/'+ res.key

                }
              }
              const observable = qiniu.upload(file,name,response.data.data.token, {}, {})
              const subscription = observable.subscribe(observer)
            }else{
              this.$message.error(response.data.msg.info);
            }
          });
      },
      //=============================================================
      quedingdakuan:function(){
        let obj = {
          id:this.all2.id,
          withdraw_pic:this.all2.withdraw_pic,
          withdraw_remark:this.all2.withdraw_remark
        }
        axios.post('/own/commission/dowithdraw',obj).then((response)=>{
        	if (response.data.msg.code == 0) {
            this.$message.success('确认打款操作成功');
            this.getlist()
            this.log2 = false
        	} else {
        		this.$message.error(response.data.msg.info);
        	}
        })
      },
      luru:function(item,type){
        this.lurutype = type
        axios.get('/own/commission/withdrawinfo?id='+item.id).then((response)=>{
        	if (response.data.msg.code == 0) {
            this.all2 = response.data.data
            this.tixianren = `提现人${this.all2.shop_name}`
            this.log2 = true
        	} else {
        		this.$message.error(response.data.msg.info);
        	}
        })
      },


      peizhikai:function(){
        this.getfapiao()
        this.log = true
      },
      peizhi:function(){
        let all = JSON.parse(JSON.stringify(this.fapiaoall))
        all.configs = JSON.stringify(all.configs)
        axios.post('/own/invoice/make',all).then((response)=>{
        	if (response.data.msg.code == 0) {
            this.$message.success('修改成功');
            this.getfapiao()
            this.log = false
        	} else {
        		this.$message.error(response.data.msg.info);
        	}
        })
      },
      getfapiao:function(){
        axios.get('/own/invoice/info').then((response)=>{
        	if (response.data.msg.code == 0) {
            this.fapiaoall = response.data.data
            this.fapiaoall.configs = JSON.parse(this.fapiaoall.configs)
        	} else {
        		this.$message.error(response.data.msg.info);
        	}
        })
      },
      handleCheckedCitiesChange(val) {
        this.fapiaojson = val;
        console.log(this.fapiaojson)
      },
      sousuo:function(){
        this.search.page = 1
        if(window.screen.width < 1080){
          this.list = []
          this.loading = false;
          this.finished = false
          this.onLoad()
        }else{
          this.getlist()
        }
      },
      getlist:function(){
        axios.get('/own/commission/withdrawtakes',{params:this.search}).then((response)=>{
        	if (response.data.msg.code == 0) {
            this.list = response.data.data.data
            this.total = response.data.data.total
            this.loading = false
        	} else {
        		this.$message.error(response.data.msg.info);
        	}
        })
      },
      fanye:function(val){
        this.search.page = val
        this.getlist()
      },
      payyzh(row){
        this.rowinfo = row
        this.isshowyzhpay = true
        axios.get('/own/commission/findAccount?id='+row.id).then((response)=>{
        	if (response.data.msg.code == 0) {
            console.log('查看是否可以支付')
            console.log(response.data.data)
            this.iscanpayinfo = response.data.data
        	} else {
        		this.$message.error(response.data.msg.info);
        	}
        })
      },
      surepay(){
          let obj = {
            id:this.rowinfo.id,
            withdraw_pic:this.rowinfo.withdraw_pic,
            withdraw_remark:this.rowinfo.withdraw_remark
          }
          axios.post('/own/commission/dowithdrawYun',obj).then((response)=>{
            if (response.data.msg.code == 0) {
              this.$message({
                type: 'success',
                message: '操作成功!'
              });
            } else {
              this.$message.error(response.data.msg.info);
            }
          })
          this.getlist()
          this.isshowyzhpay = false
      },
      //账户余额
      nowmoney(){
          axios.get('/own/commission/yunAccount').then((response)=>{
        	if (response.data.msg.code == 0) {
            console.log('账户余额')
            console.log(response.data.data)
            this.nowmoneyobj = response.data.data
        	} else {
        		this.$message.error(response.data.msg.info);
        	}
        })
      },

		}
	}
</script>


<style scoped lang="less">
  .yongjindakuan{
    /deep/ .el-checkbox{ display: block; margin-bottom: 10px;}
    /deep/ .el-textarea__inner{ background: rgb(236, 235, 235);}
    /deep/ .el-checkbox{ margin-bottom: 0;}
    .act{ background: rgb(0, 90, 255) !important; color: #fff !important;}
  }
</style>
